<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path;
    String queryString = request.getQueryString() == null
            ? ""
            : request.getQueryString().replaceAll("(\\&?lang\\=[a-zA-Z]{2}\\_[a-zA-Z]{2})|(lang\\=[a-zA-Z]{2}\\_[a-zA-Z]{2}\\&?)", "");
    String lang = request.getParameter("lang");
    String hspId = request.getParameter("hospitalId");
    if (lang != null) {
        session.setAttribute("locale", lang);
    } else if (session.getAttribute("locale") == null){
        session.setAttribute("locale", request.getLocale().toString());
    }
%>
<!DOCTYPE html>
<html lang="zh">
<c:if test="${'zh_CN'.equals(sessionScope.locale)}">
    <fmt:setLocale value="zh_CN"/>
</c:if>
<c:if test="${sessionScope.locale.indexOf('en') != -1}">
    <fmt:setLocale value="en_US"/>
</c:if>
<fmt:setBundle basename="charts" var="charts" />
<fmt:bundle basename="charts">
<head>
    <meta charset="utf-8"/>
        <%-- rem.js --%>
    <script src="<%=basePath%>/js/rem.js"></script>
    <title>医疗设备系统</title>
    <script>if ('${auth}' != '') {localStorage.setItem('auth', ${auth});}</script>
    <link rel="shortcut icon" href="<%=basePath%>/images/favicon.ico">
    <link href="<%=basePath%>/plugins/charts/css/global.css" rel="stylesheet"/>
    <link rel="stylesheet" href="<%=basePath%>/css/font-awesome.min.css">
    <link rel="stylesheet" href="<%=basePath%>/plugins/iziModal/css/iziModal.min.css">
    <link rel="stylesheet" href="<%=basePath%>/plugins/iCheck/all.css">
    <link rel="stylesheet" href="<%=basePath%>/plugins/select2/select2.min.css">
    <link href="<%=basePath%>/plugins/charts/css/style.css" rel="stylesheet"/>
    <link href="<%=basePath%>/plugins/charts/css/select2-my.css" rel="stylesheet"/>
    <link rel="stylesheet" href="<%=basePath%>/plugins/flavr/flavr.css">
</head>
<body>
<div id="container">
    <%--顶部选项--%>
    <div class="head-container">
        <div class="head">
            <div class="fl global_area">
                <i class="fa fa-arrow-left fl" onclick="javascript:history.go(-1);"></i>
                <div class="fl" id="language">
                    <div class="language">
                        <c:choose>
                            <c:when test="${'zh_CN'.equals(sessionScope.locale)}">简体中文</c:when>
                            <c:when test="${sessionScope.locale.indexOf('en') != -1}">English</c:when>
                            <c:otherwise>简体中文</c:otherwise>
                        </c:choose>
                    </div>
                    <ul class="hide">
                        <li><a href="?<%=queryString%>&lang=zh_CN">简体中文</a></li>
                        <li><a href="?<%=queryString%>&lang=en_US">English</a></li>
                    </ul>
                </div>
                <ul class="global">
                    <li><a id="btn1"><fmt:message key="share.title.zl"/></a></li>
                    <li><a id="btn2" class="on"><span class="page" page-hospital="department-index"><fmt:message key="share.title.fx"/></span></a></li>
                    <li><a id="btn5"><img src="<%=basePath%>/plugins/charts/images/search.png"></a></li>
                    <li><a id="btn6" onclick="reset()"><img src="<%=basePath%>/plugins/charts/images/reset.png"></a></li>
                    <li><a id="btn7" onclick="logout()" title="<fmt:message key="share.title.tcdl"/>"><img src="<%=basePath%>/plugins/charts/images/logout.png"></a></li>
                </ul>
            </div>
            <div class="clear"></div>
        </div>
    </div>
    <%--筛选条件--%>
    <jsp:include page="choose.jsp"></jsp:include>

    <div class="content" style="display:flex;flex-direction:column;justify-content:flex-start;">
        <%--图表和排名--%>
        <div class="bottom_bar" style="flex:1;">
            <%--左边部分--%>
            <div class="list_area fl">
                <%--总量统计--%>
                <div class="totle">
                    <%--医院总数--%>
                    <div class="frame frame1">
                        <div class="border">
                            <div class="detail fl">
                                <p class="title">
                                    <img src="<%=basePath%>/plugins/charts/images/totle_active.png"/><em id="title1"><fmt:message key="index.overview.yyks.kszs"/></em><span id="yoy0" style="font-size:0.24rem;color:#e68b36;text-decoration:none;"></span>
                                </p>
                                <p class="sum"><fmt:message key="index.overview.yyks.zs"/>：<em id="count1-1"></em> <fmt:message key="share.unit.ge"/></p>
                            </div>
                            <div class="chart fr">
                                <p><fmt:message key="index.overview.yyks.yyksfb"/></p>
                                <div id="chartA" style="height:1.4rem;width:1.4rem;margin-top:-0.028rem;"></div>
                            </div>
                            <div class="clear"></div>
                        </div>
                    </div>
                    <%--医疗设备--%>
                    <div class="frame">
                        <div class="border">
                            <div class="detail fl">
                                <p class="title"><img src="<%=basePath%>/plugins/charts/images/machine.png"/><em id="title2"><fmt:message key="index.overview.yyks.ylsb"/></em><span id="count3" style="font-size:0.24rem;color:#e68b36;text-decoration:none;"></span>
                                </p>
                                <p class="sum"><fmt:message key="index.overview.yyks.sbje"/>：<em id="count2-1"></em> <fmt:message key="share.unit.wanyuan"/></p>
                                <p class="range"><fmt:message key="share.overview.tb"/>：<span id="yoy2-1" class="yoy"></span></p>
                            </div>
                            <div class="chart fr chart-text">
                                <p class="sum"><em id="count2-2">&nbsp;</em></p>
                                <p class="line" style="border:none;height:0.52rem;">&nbsp;</p>
                                <p class="sum"><fmt:message key="index.overview.yyks.zjje"/>：<em id="count2-3"></em> <fmt:message key="share.unit.wanyuan"/></p>
                                <p class="range"><fmt:message key="index.overview.yyks.zjl"/>：<span id="yoy2-3"></span></p>
                            </div>
                            <div class="clear"></div>
                        </div>
                    </div>
                    <%-- 设备分类 --%>
                    <div class="frame">
                        <div class="border">
                            <div class="detail fl">
                                <p class="title"><img src="<%=basePath%>/plugins/charts/images/bad.png"/><em
                                        id="title3"><fmt:message key="index.overview.yyks.sbfl"/></em></p>
                                <p class="sum"><fmt:message key="index.overview.yyks.sbsl"/>：<em id="count3-1"></em> <fmt:message key="share.unit.tai"/></p>
                                <p class="range"><fmt:message key="share.overview.tb"/>：<span id="yoy3-1" class="yoy"></span></p>
                            </div>
                            <div class="chart fr">
                                <p><a class="spanTitle" href="<%=basePath%>/charts/hospital/type-index/page?hospitalId=<%=hspId%>"><fmt:message key="index.overview.yyks.sbfl"/></a></p>
                                <div id="chartB" style="height:1.4rem;width:1.4rem;margin-top:-0.028rem;"></div>
                            </div>
                            <div class="clear"></div>
                        </div>
                    </div>
                </div>

                <%--图表--%>
                <div class="border chart-border">
                    <div class="area" style="position:relative;">
                        <p class="title">
                            <span class="fl"><span class="fb spanTitle" id="moredetail"><fmt:message key="charts.title.yyksfb"/></span></span>
                            <span class="fl option_overyear"><fmt:message key="charts.button.lnsj"/></span>
                        </p>
                        <p class="fr title quadrantContainner">
                            <span class="quadrantName"><fmt:message key="charts.button.xx" />：</span>
                            <span class="quadrant quadrant1">1</span>
                            <span class="quadrant quadrant2">2</span>
                            <span class="quadrant quadrant3">3</span>
                            <span class="quadrant quadrant4">4</span>
                        </p>
                        <div id="swiper">
                            <div class="swiper-container">
                                <div class="slide home-device">
                                    <div class="chartArea" id="chart" style="height:100%;"></div>

                                    <input id="currentTag" style="display:none;" value="tendency"/>
                                    <div class="pagination pagination1"></div>
                                </div>
                                <div class="slide second">
                                    <div class="chartArea" id="chartChange" style="height:100%;"></div>
                                </div>
                            </div>
                            <%--<span class="btn btn-left">&lt;</span>
                            <span class="btn btn-right">&gt;</span>--%>

                            <div class="option-page">
                                <a href="<%=basePath%>/charts/hospital/hospital-cost/page?hospitalId=<%=hspId%>"><span class="option option_cost"><fmt:message key="share.title.yyxl"/></span></a>
                                <a href="<%=basePath%>/charts/hospital/department-maintain/page?hospitalId=<%=hspId%>"><span class="option option_maintain"><fmt:message key="share.title.wxqk"/></span></a>
                                <a href="<%=basePath%>/charts/hospital/hospital-maintenance/page?hospitalId=<%=hspId%>"><span class="option option_maintain"><fmt:message key="share.title.whqk"/></span></a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <%--左边结束--%>

            <%--右侧排名--%>
            <div class="list_data fr">
                <div class="border">
                    <div class="area">
                        <div class="data_detail">
                            <div id="top5_hospital" class="top5">
                                <p class="title">
                                    <img src="<%=basePath%>/plugins/charts/images/yljg.png">
                                    <em id="morehospitals" class="spanTitle"><fmt:message key="share.table.head.yyks"/></em>
                                    <span>TOP5</span>
                                </p>
                                <p class="name"><span class="fl data_span_f"><fmt:message key="share.table.head.yyks"/></span><span
                                        class="fl listpercent data_span_s"><fmt:message key="index.table.zb"/>(%)</span><span
                                        class="fr listcontent"><fmt:message key="index.table.sbje(wy)"/></span></p>
                                <ul class="hospital" id="ul_hospital"></ul>
                            </div>
                            <div id="top5_type" class="top5">
                                <p class="title">
                                    <img src="<%=basePath%>/plugins/charts/images/sblx.png">
                                    <em id="moretypes" class="spanTitle"><fmt:message key="share.table.head.sblx"/></em>
                                    <span>TOP5</span>
                                </p>
                                <p class="name">
                                    <span class="fl data_span_f"><fmt:message key="share.table.head.sblx"/></span>
                                    <span class="fl listpercent data_span_s"><fmt:message key="index.table.zb"/>(%)</span>
                                    <span class="fr listcontent"><fmt:message key="index.table.sbje(wy)"/></span>
                                </p>
                                <ul class="hospital" id="ul_type"></ul>
                            </div>

                            <div id="top5_year" class="top5" style="display:none;">
                                <p class="title">
                                    <em id="moreyears" class="spanTitle" onclick="moreyear()"><fmt:message key="charts.button.lnsj"/></em>
                                </p>
                                <p class="name">
                                    <span class="fl data_span_f"><fmt:message key="share.table.head.nf"/></span>
                                    <span class="fl listpercent data_span_s"></span>
                                    <span class="fr listcontent"><fmt:message key="index.table.sbje(wy)"/></span>
                                </p>
                                <ul class="hospital" id="ul_year"></ul>
                            </div>
                            <div id="top5_device" class="top5">
                                <p class="title">
                                    <em id="moredevices" class="spanTitle"><fmt:message key="share.table.head.jtsb"/></em>
                                    <span>TOP5</span>
                                </p>
                                <p class="name">
                                    <span class="fl data_span_f"><fmt:message key="share.table.head.sbmc"/></span>
                                    <span class="fl listpercent data_span_s"><fmt:message key="index.table.zb"/>(%)</span>
                                    <span class="fr listcontent"><fmt:message key="index.table.sbje(wy)"/></span>
                                </p>
                                <ul class="hospital" id="ul_device"></ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <%--右侧结束--%>
        </div>
    </div>
    <div class="baseline"></div>
    <%--详情图表模态框--%>
    <div id="modal" style="display:none">
        <div class="row">
            <div class="col-md-12">
                <div class="box-body no-padding">
                    <table id="tblSort" class="table table-bordered table-striped table-hover table-responsive">
                        <tbody id="table_data">
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <div id="typeModal" class="modal" style="display:none;padding-top: 1.16rem;height: 100%;box-sizing: border-box;">
        <div class="row">
            <div class="col-md-12">
                <div class="box-body no-padding">
                    <table id="typeTable" class="table table-bordered table-striped table-hover table-responsive">
                        <tbody>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<%-- JS部分 --%>
<script src="<%=basePath%>/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="<%=basePath%>/plugins/jQuery/jquery.cookie.js"></script>
<script src="<%=basePath%>/plugins/fastclick/fastclick_1.0.6.min.js"></script>
<script src="<%=basePath%>/plugins/flavr/flavr.min.js"></script>
<script src="<%=basePath%>/plugins/charts/js/echarts.min.js"></script>
<script src="<%=basePath%>/plugins/iCheck/icheck.min.js"></script>
<!-- 引入 macarons 主题 -->
<script src="<%=basePath%>/echarts/customed.js"></script>
<script src="<%=basePath%>/plugins/select2/select2.full.min.js"></script>
<script src="<%=basePath%>/plugins/select2/i18n/zh-CN.js"></script>
<script src="<%=basePath%>/plugins/iziModal/js/iziModal.min.js"></script>
<script src="<%=basePath%>/plugins/jQuery/JQMeter.min.js"></script>
<script src="<%=basePath%>/plugins/charts/js/plugins.js"></script>
<script src="<%=basePath%>/plugins/charts/js/tableHeadFixer.js"></script>
<script>
    /*--------- 全局变量 ---------*/
    var CONST = 1000000;
    var basePath = '<%=basePath%>';
    var listcontentWidth = $('.listcontent').eq(0).width();
    var hspId = GetQueryString('hospitalId');
    /*--------- 全局变量 ---------*/

    /* 页面初始化 */
    $(function () {
        loading(function () {
            addChooseRadioEvent('hospital');
            resizeWindow();
            initChart();  // 初始化图表
            ChooseBox.siblingsClick();
            querySearch("department", '');
            querySearch("risk", '');
            querySearch("type", '');
            querySearch("brand", '');
            querySearch("year", '');
            appendTime();
            getParams();
            clickToggle($('.quadrant'));
            $("#btn5").click(function () {
                ChooseBox.toggle();
            });
        });
    });

    // 初始化图表并添加图表点击事件
    function initChart() {
        chart = echarts.init(document.getElementById('chart'), 'customed');  // 初始化echarts实例
        chartA = echarts.init(document.getElementById('chartA'), 'customed');
        chartB = echarts.init(document.getElementById('chartB'), 'customed');
        chart.on("click", click);
    }

    var queryStatus = {
        arr: ['hospital', 'type', 'assets'],
        getStatus: function () {
            for (var i = 0; i < this.arr.length; i++) {
                if (!this[this.arr[i]]) return false;
            }
            return true;
        },
        resetStatus: function () {
            for (var i = 0; i < this.arr.length; i++) {
                this[this.arr[i]] = false;
            }
        }
    };
    function click(param) {
        if (typeof param.seriesIndex === 'undefined') {
            return;
        }
        if (param.componentType === 'markLine') {
            return;
        }
        loading();
        if (param.type === 'click') {
            var index = param.dataIndex;

            if($('.option_overyear').hasClass('active')){
                loading(true);
                return;
                $('.select_year').val(idsB[index]).trigger('change');
                $('.option_overyear').removeClass('active');
                getParams();
            } else {
                var tab;
                if(($('.select_hospital').val() ? $('.select_hospital').val() : []).join(',') == [hospitalJson[index].id].join(',')){
                    $('.select_hospital').val('').trigger('change');
                    hospitalId = '';
                    tab = false;
                    index = 0;
                } else {
                    $('.select_hospital').val([hospitalJson[index].id]).trigger('change');
                    hospitalId = [hospitalJson[index].id];
                    tab = true;
                }
                setUlHospital('desc', index, tab);
                queryStatus.hospital = true;
                queryTypeTop5Data();
                queryDeviceTop5Data();
            }
        }
    }


    //查询筛选条件
    var typeIdArr;
    function querySearch(tag) {
        var url = "<%=basePath%>/hospital/search/" + tag;
        $.ajax({
            type: "POST",
            data: {
                hospitalId: hspId
            },
            url: url,
            dataType: "json",
            async: false,
            success: function (data) {
                if (data.ret == 1) {
                    data.data = data.data || {list:[]};
                    var searchData = data.data;
                    setSearch(tag, searchData);
                    $('.select_' + (tag == 'department' ? 'hospital' : tag)).select2({
                        placeholder: '<fmt:message key="share.sift.qxz"/>',
                        allowClear: true
                    });
                    ChooseBox.setSearchFromCookie(tag);
                    if(tag == 'type') {
                        searchDataGlobal = searchData;
                        $('.select_type').on('select2:select', function (param) {
                            typeIdArr =  $('.select_type').val();
                            var id = param.params.data.id;
                            if(id < 2016102346) {
                                for (var i = 0; i < searchDataGlobal[id].length; i++) {
                                    typeIdArr.push(searchDataGlobal[id][i].id)
                                }
                            }
                            $('.select_type').val(typeIdArr).trigger('change');
                        });
                        $('.select_type').on('select2:unselect', function (param) {
                            typeIdArr =  $('.select_type').val();
                            var id = param.params.data.id;
                            typeIdArr.removeByValue(id);
                            if(id < 2016102346) {
                                for (var i = 0; i < searchDataGlobal[id].length; i++) {
                                    typeIdArr.removeByValue(searchDataGlobal[id][i].id)
                                }
                            }
                            $('.select_type').val(typeIdArr).trigger('change');
                        });
                    }
                } else {
                    if (data.msg == '该用户不存在') {
                        location.href = '<%=basePath%>';
                    } else {
                        flavrShowByTime(data.msg, null, "danger", false);
                    }
                }
            },
            failure: function () {
                flavrShowByTime(data.msg, null, "danger", false);
            }
        })
    }
    /* 设置搜索框搜索条件 */
    function setSearch(tag, data) {
        var first, second, id, str, str1;
        if (tag === "type") {
            str = '';
            first = data.first;
            for(var i = 0; i < first.length; i++){
                //一级设备
                if('${sessionScope.locale}'.indexOf('en') != -1) {
                    str += '<optgroup label="' + (first[i].enName || "") + '">' +
                        (function () {
                            str1 = '';
                            id = first[i].id;
                            if (data[id]) {
                                //一级设备
                                str1 = '<option value="' + first[i].id + '">' + (first[i].enName || "") + '</option>';
                                second = data[id];
                                for (var j = 0; j < second.length; j++) {
                                    //二级设备
                                    str1 += '<option value="' + second[j].id + '">' + (second[j].enName || "") + '</option>';
                                }
                            } else {
                                str1 = '<option value="' + first[i].id + '">' + (first[i].enName || "") + '</option>';
                            }
                            return str1;
                        })() +
                        '</optgroup>';
                } else {
                    str += '<optgroup label="' + (first[i].name || "") + '">' +
                        (function () {
                            str1 = '';
                            id = first[i].id;
                            if (data[id]) {
                                //一级设备
                                str1 = '<option value="' + first[i].id + '">' + (first[i].name || "") + '</option>';
                                second = data[id];
                                for (var j = 0; j < second.length; j++) {
                                    //二级设备
                                    str1 += '<option value="' + second[j].id + '">' + (second[j].name || "") + '</option>';
                                }
                            } else {
                                str1 = '<option value="' + first[i].id + '">' + (first[i].name || "") + '</option>';
                            }
                            return str1;
                        })() +
                        '</optgroup>';
                }
            }
            $(".select_type").append(str);
        } else {
            data = data.list;
            if (tag == 'department') {
                if('${sessionScope.locale}'.indexOf('en') != -1) {
                    for (var i = 0; i < data.length; i++) {
                        $(".select_" + 'hospital').append('<option value="' + data[i].id + '">' + (data[i].enName || "") + '</option>');
                    }
                } else {
                    for (var i = 0; i < data.length; i++) {
                        $(".select_" + 'hospital').append('<option value="' + data[i].id + '">' + (data[i].name || "") + '</option>');
                    }
                }
            } else {
                if('${sessionScope.locale}'.indexOf('en') != -1) {
                    for (var i = 0; i < data.length; i++) {
                        $(".select_" + tag).append('<option value="' + data[i].id + '">' + (data[i].enName || "") + '</option>');
                    }
                } else {
                    for (var i = 0; i < data.length; i++) {
                        $(".select_" + tag).append('<option value="' + data[i].id + '">' + (data[i].name || "") + '</option>');
                    }
                }
            }
        }

    }

    //全市详情
    function queryAllAssets() {
        $.ajax({
            type: "POST",
            url: "<%=basePath%>/charts/hospital/department-index/overview",
            async: false,
            data: {
                hospitalId: hspId,
                departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                riskId: riskId ? JSON.stringify(riskId) : '',
                typeId: typeId ? JSON.stringify(typeId) : '',
                brandId: brandId ? JSON.stringify(brandId) : '',
                year: year ? JSON.stringify(year) : '',
                enableYearStart: enableYearStart,
                enableYearEnd: enableYearEnd,
                priceStart: priceStart,
                priceEnd: priceEnd,
                ageLimitStart: ageLimitStart,
                ageLimitEnd: ageLimitEnd
            },
            dataType: "json",
            success: function (data) {
                if(data.ret == 1){
                    data.data = data.data || {list:[]};
                    data = data.data;
                    assets = data;
                    // 医院总数
                    $('#count1-1').html(data.allAssets.hospitalCounts || 0);
                    // 设备金额 和 同比
                    $('#count2-1').html(parseFloat(data.allAssets.curPrice / (CONST) || 0).toFixed(2));
                    $('#yoy2-1').html(parseFloat(data.allAssets.devicePriceYoy || 0).toFixed(2) + ' %');
                    // 折旧金额 和 折旧率
                    $('#count2-3').html(parseFloat(data.allAssets.curDepreciationPrice / (CONST) || 0).toFixed(2));
                    $('#yoy2-3').html(parseFloat(data.allAssets.depreciationRatio || 0).toFixed(2) + ' %');
                    // 设备数量 和 同比
                    $('#count3-1').html(data.allAssets.curCounts || 0);
                    $('#yoy3-1').html(parseFloat(data.allAssets.deviceCountsYoy || 0).toFixed(2) + ' %');

                    // 医院等级饼图
                    var seriesHospitalLevel = [];
                    departmentPrice = [];
                    for (var i = 0; i < data.department.length; i++) {
                        departmentPrice.push(parseFloat((data.department[i].curPrice / CONST) || 0).toFixed(2));
                        seriesHospitalLevel.push({name: data.department[i].name, value: data.department[i].curCounts});
                    }
                    optionHospitalLevel.series[0].data = seriesHospitalLevel;
                    chartA.setOption(optionHospitalLevel);

                    // 设备类型分布饼图
                    var seriesTypeList = [];
                    TypeListPrice = [];
                    for (var i = 0; i < data.firstTypeList.length; i++) {
                        TypeListPrice.push(data.firstTypeList[i].curCounts || 0);
                        seriesTypeList.push({name: data.firstTypeList[i].name, value: fix2(data.firstTypeList[i].curPrice / CONST)});
                    }
                    optionTypeList.series[0].data = seriesTypeList;
                    chartB.setOption(optionTypeList);

                    addArrowYoy('.totle');
                } else{
                    flavrShowByTime(data.msg, null, "danger", false);
                }
            },
            failure: function () {
                flavrShowByTime(data.msg, null, "danger", false);
            }
        });
    }

    //医院top5
    function setUlHospital(sortord, index, tab) {
        var len = hospitalJson.length;
        var x = 0,
            y = 0;
        if (index < 3) {
            x = 0;
        } else if(len - index < 3){
            x = (len - 5) > 0 ? (len - 5) : 0;
        } else {
            x = index - 2;
        }
        y = len > 5 ? x + 5 : len;
        var percent, count, name, fullName;
        $("#ul_hospital").html('');
        for (var i = x; i < y; i++) {
            percent = assets.allAssets.curPrice ? fix2(hospitalJson[i].curPrice * 100 / assets.allAssets.curPrice): '0.00';
            count = fix2(hospitalJson[i].curPrice/CONST);
            name = fixStr(hospitalJson[i][lang==='en'?'enName':'name']);
            fullName = fixStr(hospitalJson[i][lang==='en'?'fullEnName':'fullName']);
            $("#ul_hospital").append(
                '<li><a title="' + (i + 1) + ' ' + fullName + '"' + ((tab && i == index) ? 'class="active"' : '') + ' onclick="query(\'hospital\',\''+hospitalJson[i].id+'\')"><span class="fl data_span_f spanTitle">' + name + '</span><em class="fl data_span_s jqmeter" jqmeter="'
                + percent + '"></em><em class="fr">'  + count + '</em></a></li>');
        }
        $('#ul_hospital .jqmeter').each(function() {
            $(this).jQMeter({
                goal:'$1,00',
                raised:'$' + Math.round($(this).attr('jqmeter')),
                width:listcontentWidth - 20 + 'px',
                height:'0.24rem'
            });
        });
    }

    //设置与图表对应的表的内容
    function setUlType(sortord, index) {
        var len = (typeJson[-1].list || []).length;
        var x = 0,
            y = 0;
        if (index < 3) {
            x = 0;
        } else if(len - index < 3){
            x = (len - 5) > 0 ? (len - 5) : 0;
        } else {
            x = index - 2;
        }
        y = len > 5 ? x + 5 : len;
        var percent, count;
        $("#ul_type").html('');
        for (var i = x; i < y; i++) {
            percent = assets.allAssets.curPrice ? fix2(typeJson[-1].list[i].curPrice * 100 / assets.allAssets.curPrice) : '0.00';
            count = fix2(typeJson[-1].list[i].curPrice / CONST);
            $("#ul_type").append(
                '<li><a title="'+ (i + 1) + ' ' + fixStr(typeJson[-1].list[i][lang==='en'?'fullEnName':'fullName']) + '" onclick="query(\'type\',\''+typeJson[-1].list[i].id+'\')"><span class="fl data_span_f spanTitle">' + fixStr(typeJson[-1].list[i][lang==='en'?'enName':'name']) + '</span><em class="fl data_span_s jqmeter" jqmeter="'
                + percent + '"></em><em class="fr">'  + count + '</em></a></li>');
        }
        $('#ul_type .jqmeter').each(function() {
            $(this).jQMeter({
                goal:'$1,00',
                raised:'$' + Math.round($(this).attr('jqmeter')),
                width:listcontentWidth - 20 + 'px',
                height:'0.24rem'
            });
        });
    }

    function setUlDevice(sortord, index) {
        var len = deviceJson.length;
        var x = 0,
            y = 0;
        if (index < 3) {
            x = 0;
        } else if(len - index < 3){
            x = (len - 5) > 0 ? (len - 5) : 0;
        } else {
            x = index - 2;
        }
        y = len > 5 ? x + 5 : len;
        var percent, count;
        $("#ul_device").html('');
        for (var i = x; i < y; i++) {
            percent = assets.allAssets.curPrice ? fix2(deviceJson[i].price * 100 / assets.allAssets.curPrice) : '0.00';
            count = fix2(deviceJson[i].price/CONST);
            $("#ul_device").append(
                '<li><a title="'+ (i + 1) + ' ' + deviceJson[i].name + '" onclick="query(\'device\',\''+deviceJson[i].id+'\')"><span class="fl data_span_f spanTitle">' + deviceJson[i].name + '</span><em class="fl data_span_s jqmeter" jqmeter="'
                + percent + '"></em><em class="fr">'  + count + '</em></a></li>');
        }
        $('#ul_device .jqmeter').each(function() {
            $(this).jQMeter({
                goal:'$1,00',
                raised:'$' + Math.round($(this).attr('jqmeter')),
                width:listcontentWidth - 20 + 'px',
                height:'0.24rem'
            });
        });
    }


    //获取筛选条件参数
    function getParams() {
        loading(function () {
            $('.quadrantContainner').show();
            $('.quadrant').removeClass('active');
            $('.option_overyear').html('<fmt:message key="charts.button.lnsj"/>').removeClass('active');
            showYearTop5();
            $('#moredetail').html('<fmt:message key="charts.title.yyksfb"/>').off().on('click', morehospitals);

            hospitalId = $('.select_hospital').val() ? $('.select_hospital').val() : '';
            riskId = $('.select_risk').val() ? $('.select_risk').val() : '';
            typeId = $('.select_type').val() ? $('.select_type').val() : '';
            brandId = $('.select_brand').val() ? $('.select_brand').val() : '';
            year = $('.select_year').val() ? $('.select_year').val() : '';
            monthId = $('.select_month').val() ? $('.select_month').val() : '';
            enableYearStart = $('#enableYearStart').val() ? $('#enableYearStart').val() : '';
            enableYearEnd = $('#enableYearEnd').val() ? $('#enableYearEnd').val() : '';
            priceStart = $('#priceStart').val() ? $('#priceStart').val() * CONST : '';
            priceEnd = $('#priceEnd').val() ? $('#priceEnd').val() * CONST : '';
            ageLimitStart = $('#ageLimitStart').val() ? $('#ageLimitStart').val() : '';
            ageLimitEnd = $('#ageLimitEnd').val() ? $('#ageLimitEnd').val() : '';

            $.cookie('chooseValue', JSON.stringify({
                hospitalId: hospitalId,
                riskId: riskId,
                typeId: typeId,
                brandId: brandId,
                year: year,
                monthId: monthId,
                enableYearStart: enableYearStart,
                enableYearEnd: enableYearEnd,
                priceStart: priceStart,
                priceEnd: priceEnd,
                ageLimitStart: ageLimitStart,
                ageLimitEnd: ageLimitEnd
            }), {path: '/'});

            queryAllAssets();
            queryChartsData();
            queryTypeTop5Data();
            queryDeviceTop5Data();
        });
    }

    // 获取图表数据(医院)
    function queryChartsData() {
        hospitalJson = [];
        $.ajax({
            type: "POST",
            url: '<%=basePath%>/charts/hospital/department-index/department',
            data: {
                hospitalId: hspId,
                departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                riskId: riskId ? JSON.stringify(riskId) : '',
                typeId: typeId ? JSON.stringify(typeId) : '',
                brandId: brandId ? JSON.stringify(brandId) : '',
                year: year ? JSON.stringify(year) : '',
                enableYearStart: enableYearStart,
                enableYearEnd: enableYearEnd,
                priceStart: priceStart,
                priceEnd: priceEnd,
                ageLimitStart: ageLimitStart,
                ageLimitEnd: ageLimitEnd
            },
            dataType: "json",
            success: function (data) {
                if(data.ret){
                    data.data = data.data || {list:[]};
                    hospitalJson = data.data.list;
                    var series = [];
                    for(var i = 0; i < hospitalJson.length; i++){
                        series.push([fix2(hospitalJson[i].curPrice / CONST), fix0(hospitalJson[i].curCounts), fix2(hospitalJson[i].curAgeLimitMeasure), hospitalJson[i].name]);
                    }
                    (hospitalJson || []).sortByKey('curPrice').calTotal();
                    optionAgelimit.series[0].markLine.data[0].xAxis = parseFloat((data.data.avgPrice || 0) / CONST).toFixed(2);
                    optionAgelimit.series[0].markLine.data[1].yAxis = parseFloat(data.data.avgCounts || 0).toFixed(2);
                    optionAgelimit.series[0].data = series;
                    chart.clear();
                    chart.setOption(optionAgelimit);
                } else{
                    flavrShowByTime(data.msg, null, "danger", false);
                }
                setUlHospital('desc', 0);
                if ((!$('#modal').is(':hidden')) && ($('#modal').attr('modal') == 'hospital')) morehospitals();

                queryStatus.hospital = true;
                if (queryStatus.getStatus()) {
                    loading(true);
                    queryStatus.resetStatus();
                }
            },
            failure: function () {
                flavrShowByTime(data.msg, null, "danger", false);
            }
        })
    }

    // 获取图表数据(设备类型)
    function queryTypeTop5Data() {
        typeJson = [];
        $.ajax({
            type: "POST",
            url: '<%=basePath%>/charts/hospital/department-index/type',
            data: {
                hospitalId: hspId,
                departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                riskId: riskId ? JSON.stringify(riskId) : '',
                typeId: typeId ? JSON.stringify(typeId) : '',
                brandId: brandId ? JSON.stringify(brandId) : '',
                year: year ? JSON.stringify(year) : '',
                enableYearStart: enableYearStart,
                enableYearEnd: enableYearEnd,
                priceStart: priceStart,
                priceEnd: priceEnd,
                ageLimitStart: ageLimitStart,
                ageLimitEnd: ageLimitEnd
            },
            dataType: "json",
            success: function (data) {
                if(data.ret){
                    data.data = data.data || {list:[]};
                    typeJson = (data.data.list || []).sortByKey('curPrice').calTotal();
                } else{
                    flavrShowByTime(data.msg, null, "danger", false);
                }
                setUlType('desc', 0);
                if ((!$('#modal').is(':hidden')) && ($('#modal').attr('modal') == 'type')) moretypes();

                queryStatus.type = true;
                if (queryStatus.getStatus()) {
                    loading(true);
                    queryStatus.resetStatus();
                }
            },
            failure: function (data) {
                flavrShowByTime(data.msg, null, "danger", false);
            }
        })
    }

    function queryDeviceTop5Data(){
        deviceJson = [];
        $.ajax({
            type: "POST",
            url: '<%=basePath%>/charts/hospital/department-index/assets',
            data: {
              hospitalId: hspId,
                departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                riskId: riskId ? JSON.stringify(riskId) : '',
                typeId: typeId ? JSON.stringify(typeId) : '',
                brandId: brandId ? JSON.stringify(brandId) : '',
                year: year ? JSON.stringify(year) : '',
                enableYearStart: enableYearStart,
                enableYearEnd: enableYearEnd,
                priceStart: priceStart,
                priceEnd: priceEnd,
                ageLimitStart: ageLimitStart,
                ageLimitEnd: ageLimitEnd
            },
            dataType: "json",
            success: function (data) {
                if(data.ret){
                    data.data = data.data || {list:[]};
                    deviceJson = data.data.list;
                    (deviceJson || []).sortByKey('curPrice').calTotal();
                } else{
                    flavrShowByTime(data.msg, null, "danger", false);
                }
                setUlDevice('desc', 0);
                if ((!$('#modal').is(':hidden')) && ($('#modal').attr('modal') == 'device')) moredevices();

                queryStatus.assets = true;
                if (queryStatus.getStatus()) {
                    loading(true);
                    queryStatus.resetStatus();
                }
            },
            failure: function (data) {
                flavrShowByTime(data.msg, null, "danger", false);
            }
        })
    }

    $('#moredetail, #morehospitals').click(morehospitals);
    function morehospitals(param){
        loading(function () {
            param = $.extend({}, {
                id: '',
                dataJson: hospitalJson,
                modal: 'modal',
                table: 'tblSort'
            }, param);
            var data = $.extend([], param.dataJson);
            var modal = $('#' + param.modal);
            var table = $('#' + param.table);
            modal.attr('modal', 'hospital');
            var sb = new StringBuffer();
            table.html('<tbody></tbody>');
            tbody = table.find('tbody');
            sb.append("<thead><tr><th class='text-center'>#</th>");
            //表头
            sb.append("<th class='text-left'><fmt:message key="share.table.head.yyks"/></th>");

            //表格内容
            sb.append("<th class='text-right'><fmt:message key="index.table.sbje(wy)"/></th>"
                + "<th class='text-right'><fmt:message key="index.table.ncsbje(wy)"/></th>"
                + "<th class='text-right'><fmt:message key="index.table.sbsl(t)"/></th>"
                + "<th class='text-right'><fmt:message key="index.table.xzsbsl(t)"/></th>"
                + "<th class='text-right'><fmt:message key="index.table.bfsl(t)"/></th>"
                + "<th class='text-right'><fmt:message key="index.table.sbjetb(%)"/></th>"
                + "<th class='text-right'><fmt:message key="index.table.sbsltb(%)"/></th>"
                + "<th class='text-right'><fmt:message key="index.table.zjje(wy)"/></th>"
                + "<th class='text-right'><fmt:message key="index.table.nxzs"/></th>"
                + "</tr></thead>");
            table.prepend(sb.toString());
            groupLoading(data.length, function (min, max) {
                var str = '';
                for (var i = min; i < max; i++) {
                    str += "<tr>"
                        + "<td class='no-cal text-center'>" + (i + 1) + "</td>"
                        + "<td class='no-cal spanTitle' onclick='query(\"hospital\", \"" + data[i].id + "\")'>" + fixStr(data[i][lang === 'en' ? 'enName' : 'name']) + "</td>"
                        + "<td class='total-1 text-right'>" + parseFloat(data[i].curPrice / CONST || 0).toFixed(2) + "</td>"
                        + "<td class='total-4 text-right'>" + parseFloat(data[i].curBeginPrice / CONST || 0).toFixed(2) + "</td>"
                        + "<td class='total-2 text-right" + (data[i].curCounts ? ' spanTitle' : '') + "' onclick=\"query('hospital','{" + (param.id ? 'year:' + param.id + ',' : '') + "departmentId:[" + data[i].id + "]}','" + data[i].curCounts + "')\">" + (data[i].curCounts || 0) + "</td>"
                        + "<td class='total-5 text-right" + (data[i].curNewlyCounts ? ' spanTitle' : '') + "' onclick=\"query('newly','{" + (param.id ? 'year:' + param.id + ',' : '') + "departmentId:[" + data[i].id + "]}','" + data[i].curNewlyCounts + "')\">" + (data[i].curNewlyCounts || 0) + "</td>"
                        + "<td class='total-6 text-right" + (data[i].curScrapCounts ? ' spanTitle' : '') + "' onclick=\"query('scrap','{" + (param.id ? 'year:' + param.id + ',' : '') + "departmentId:[" + data[i].id + "]}','" + data[i].curScrapCounts + "')\">" + (data[i].curScrapCounts || 0) + "</td>"
                        + "<td class='avg-3 text-right yoy'>" + parseFloat(data[i].devicePriceYoy || 0).toFixed(2) + "</td>"
                        + "<td class='avg-4 text-right yoy'>" + parseFloat(data[i].deviceCountsYoy || 0).toFixed(2) + "</td>"
                        + "<td class='total-7 text-right'>" + parseFloat(data[i].curDepreciationPrice / CONST || 0).toFixed(2) + "</td>"
                        + "<td class='avg-1 text-right '>" + parseFloat(data[i].curAgeLimitMeasure).toFixed(2) + "</td>"
                        + "</tr>";
                }
                tbody.append(str);
                if (max === data.length) calTableData(param.table, true);
            });
            modal.iziModal('setTitle', '<fmt:message key="charts.title.yyksfb"/>');
            modal.iziModal('open', this);
            loading(true);
        });
    }

    $('#moretypes').click(moretypes);

    function moretypes(param) {
        loading(function () {
            param = $.extend({}, {
                id: '',
                dataJson: typeJson,
                modal: 'modal',
                table: 'tblSort'
            }, param);
            var data = $.extend([], param.dataJson);
            var modal = $('#' + param.modal).attr('modal', 'type');
            var sb = new StringBuffer();
            var table = $('#' + param.table).html('<tbody></tbody>');
            var tbody = table.find('tbody');
            sb.append("<thead><tr><th class='text-center' key='name' value='<fmt:message key="share.table.tail.zj"/>'><fmt:message key="index.table.yjsb"/></th>");
            //表头
            sb.append("<th class='text-left' key='name'><fmt:message key="share.table.head.sblx"/></th>");

            //表格内容.
            sb.append("<th class='text-right' key='curPrice' value='" + fix2(data[-1].curPrice / CONST) + "'><fmt:message key="index.table.sbje(wy)"/></th>"
                + "<th class='text-right' key='curBeginPrice' value='" + fix2(data[-1].curBeginPrice / CONST) + "'><fmt:message key="index.table.ncsbje(wy)"/></th>"
                + "<th class='text-right' key='curCounts' value='" + fix2(data[-1].curCounts) + "'><fmt:message key="index.table.sbsl(t)"/></th>"
                + "<th class='text-right' key='curNewlyCounts' value='" + fix0(data[-1].curNewlyCounts) + "'><fmt:message key="index.table.xzsbsl(t)"/></th>"
                + "<th class='text-right' key='curScrapCounts' value='" + fix0(data[-1].curScrapCounts) + "'><fmt:message key="index.table.bfsl(t)"/></th>"
                + "<th class='text-right' key='devicePriceYoy' value='" + fix2(data[-1].devicePriceYoy / data.length) + "'><fmt:message key="index.table.sbjetb(%)"/></th>"
                + "<th class='text-right' key='deviceCountsYoy' value='" + fix2(data[-1].deviceCountsYoy / data.length) + "'><fmt:message key="index.table.sbsltb(%)"/></th>"
                + "<th class='text-right' key='curDepreciationPrice' value='" + fix2(data[-1].curDepreciationPrice / CONST) + "'><fmt:message key="index.table.zjje(wy)"/></th>"
                + "<th class='text-right' key='curAgeLimitMeasure' value='" + fix2(data[-1].curAgeLimitMeasure / data.length) + "'><fmt:message key="index.table.nxzs"/></th>"
                + "</tr></thead>");
            table.prepend(sb.toString());
            groupLoading(data.length, function (min, max) {
                var str = '';
                for (var i = min; i < max; i++) {
                    str += "<tr>"
                        + "<td class='no-cal border-bottom' rowspan='" + (data[i].list.length + 1) + "'>" + fixStr(data[i][lang === 'en' ? 'enName' : 'name']) + "</td>"
                        + "<td class='no-cal text-left'><fmt:message key="share.table.tail.xj"/></td>"
                        + "<td class='total-1 text-right'>" + parseFloat(data[i].curPrice / CONST || 0).toFixed(2) + "</td>"
                        + "<td class='total-4 text-right'>" + parseFloat(data[i].curBeginPrice / CONST || 0).toFixed(2) + "</td>"
                        + "<td class='total-2 text-right" + (data[i].curCounts ? ' spanTitle' : '') + "' onclick=\"query('hospital','{" + (param.id ? 'year:' + param.id + ',' : '') + "typeId:[" + data[i].id + "]}','" + data[i].curCounts + "')\">" + (data[i].curCounts || 0) + "</td>"
                        + "<td class='total-5 text-right" + (data[i].curNewlyCounts ? ' spanTitle' : '') + "' onclick=\"query('newly','{" + (param.id ? 'year:' + param.id + ',' : '') + "typeId:[" + data[i].id + "]}','" + data[i].curNewlyCounts + "')\">" + (data[i].curNewlyCounts || 0) + "</td>"
                        + "<td class='total-6 text-right" + (data[i].curScrapCounts ? ' spanTitle' : '') + "' onclick=\"query('scrap','{" + (param.id ? 'year:' + param.id + ',' : '') + "typeId:[" + data[i].id + "]}','" + data[i].curScrapCounts + "')\">" + (data[i].curScrapCounts || 0) + "</td>"
                        + "<td class='avg-1 text-right yoy'>" + parseFloat(data[i].devicePriceYoy).toFixed(2) + "</td>"
                        + "<td class='avg-2 text-right yoy'>" + parseFloat(data[i].deviceCountsYoy).toFixed(2) + "</td>"
                        + "<td class='total-3 text-right'>" + parseFloat(data[i].curDepreciationPrice / CONST).toFixed(2) + "</td>"
                        + "<td class='avg-3 text-right'>" + parseFloat(data[i].curAgeLimitMeasure).toFixed(2) + "</td>"
                        + "</tr>";
                    for (var j = 0; j < data[i].list.length; j++) {
                        str += "<tr" + (j === (data[i].list.length - 1) ? ' class="border-bottom"' : '') + ">"
                            + "<td class='no-cal text-left spanTitle' onclick='query(\"type\", \"" + data[i].list[j].id + "\")'>" + fixStr(data[i].list[j][lang === 'en' ? 'enName' : 'name']) + "</td>"
                            + "<td class='total-1 text-right'>" + parseFloat(data[i].list[j].curPrice / CONST || 0).toFixed(2) + "</td>"
                            + "<td class='total-4 text-right'>" + parseFloat(data[i].list[j].curBeginPrice / CONST || 0).toFixed(2) + "</td>"
                            + "<td class='total-2 text-right" + (data[i].list[j].curCounts ? ' spanTitle' : '') + "' onclick=\"query('hospital','{" + (param.id ? 'year:' + param.id + ',' : '') + "typeId:[" + data[i].list[j].id + "]}','" + data[i].list[j].curCounts + "')\">" + (data[i].list[j].curCounts || 0) + "</td>"
                            + "<td class='total-5 text-right" + (data[i].list[j].curNewlyCounts ? ' spanTitle' : '') + "' onclick=\"query('newly','{" + (param.id ? 'year:' + param.id + ',' : '') + "typeId:[" + data[i].list[j].id + "]}','" + data[i].list[j].curNewlyCounts + "')\">" + (data[i].list[j].curNewlyCounts || 0) + "</td>"
                            + "<td class='total-6 text-right" + (data[i].list[j].curScrapCounts ? ' spanTitle' : '') + "' onclick=\"query('scrap','{" + (param.id ? 'year:' + param.id + ',' : '') + "typeId:[" + data[i].list[j].id + "]}','" + data[i].list[j].curScrapCounts + "')\">" + (data[i].list[j].curScrapCounts || 0) + "</td>"
                            + "<td class='avg-1 text-right yoy'>" + parseFloat(data[i].list[j].devicePriceYoy).toFixed(2) + "</td>"
                            + "<td class='avg-2 text-right yoy'>" + parseFloat(data[i].list[j].deviceCountsYoy).toFixed(2) + "</td>"
                            + "<td class='total-3 text-right'>" + parseFloat(data[i].list[j].curDepreciationPrice / CONST).toFixed(2) + "</td>"
                            + "<td class='avg-3 text-right'>" + parseFloat(data[i].list[j].curAgeLimitMeasure).toFixed(2) + "</td>"
                            + "</tr>";
                    }
                }
                tbody.append(str);
                if (max === data.length) calTableData({tableId: param.table, isType: true, param: param}, true);
            });
            modal.iziModal('setTitle', '<fmt:message key="charts.title.sblxfb"/>');
            modal.iziModal('open');
            loading(true);
        });
    }

    $('#moredevices').click(moredevices);
    function moredevices(){
        loading(function () {
            var modal = $('#modal').attr('modal', 'device');
            var sb = new StringBuffer();
            var table = $("#tblSort").html('<tbody></tbody>');
            var tbody = table.find('tbody');
            var data = deviceJson;
            sb.append("<thead><tr><th class='text-center' key='' value='<fmt:message key="share.table.tail.zj"/>'>#</th>");
            //表头
            sb.append("<th class='text-left' key='name'><fmt:message key="share.table.head.sbmc"/></th>");

            //表格内容
            sb.append("<th class='text-left' key='modalName'><fmt:message key="share.table.head.sbxh"/></th>"
                + "<th class='text-left' key='firstTypeName'><fmt:message key="share.title.sblx"/></th>"
                + "<th class='text-left' key='departmentName'><fmt:message key="share.assets.ssks"/></th>"
                + "<th class='text-left' key='manufacturer'><fmt:message key="share.table.head.sbcj"/></th>"
                + "<th class='text-left' key='sn' value=''><fmt:message key="share.assets.snbh"/></th>"
                + "<th class='text-left' key='assetsNo' value=''><fmt:message key="share.assets.zcbh"/></th>"
                + "<th class='text-left' key='enableDate' value=''><fmt:message key="share.assets.sbqyrq"/></th>"
                + "<th class='text-right' key='price' value='" + fix2(data[-1].price / CONST) + "'><fmt:message key="share.assets.sbje(wy)"/></th>"
                + "<th class='text-right' key='depreciationPrice' value='" + fix2(data[-1].depreciationPrice / CONST) + "'><fmt:message key="share.assets.zjje(wy)"/></th>"
                + "<th class='text-right' key='usedTime' value='" + fix2(data[-1].usedTime / data.length) + "'><fmt:message key="share.assets.ysysj(n)"/></th>"
                + "<th class='text-right' key='ageLimitMeasure' value='" + fix2(data[-1].ageLimitMeasure / data.length) + "'><fmt:message key="share.assets.nxzs"/></th>"
                + "</tr></thead>");
            table.prepend(sb.toString());
            groupLoading(data.length, function (min, max) {
                var str = '';
                for (var i = min; i < max; i++) {
                    str += "<tr>"
                        + "<td class='no-cal text-center'>" + (i + 1) + "</td>"
                        + "<td class='no-cal spanTitle' onclick='query(\"device\",\"" + data[i].id + "\")' title='" + data[i].name + "'>" + data[i].name + "</td>"
                        + "<td class='no-cal' title='" + data[i].modalName + "'>" + data[i].modalName + "</td>"
                        + "<td class='no-cal'>" + fixStr(data[i].firstTypeName) + "</td>"
                        + "<td class='no-cal'>" + fixStr(data[i].department) + "</td>"
                        + "<td class='no-cal' title='" + fixStr(data[i].manufacturer) + "'>" + fixStr(data[i].manufacturer) + "</td>"
                        + "<td class='no-cal'>" + fixStr(data[i].sn) + "</td>"
                        + "<td class='no-cal'>" + fixStr(data[i].assetsNo) + "</td>"
                        + "<td class='no-cal'>" + fixStr(data[i].enableDate) + "</td>"
                        + "<td class='total-1 text-right'>" + fix2(data[i].price / CONST) + "</td>"
                        + "<td class='total-2 text-right'>" + fix2(data[i].depreciationPrice / CONST) + "</td>"
                        + "<td class='total-3 text-right'>" + fix2(data[i].usedTime) + "</td>"
                        + "<td class='avg-4 text-right'>" + fix2(data[i].ageLimitMeasure) + "</td>"
                        + "</tr>";
                }
                tbody.append(str);
                if (max === data.length) calTableData('tblSort', true);
            });
            modal.iziModal('setTitle', '<fmt:message key="share.table.title.sbfbxq"/>');
            modal.iziModal('open', this);
            loading(true);
        });
    }

    function query(tag, id, detailId){
        if(detailId) {
            if(tag === 'hospital') {
                queryDeviceTable($.extend({}, string2json(id)));
            } else if (tag === 'newly') {
                queryAssets($.extend({}, string2json(id), {assetsTag: 1}));
            } else if (tag === 'scrap') {
                queryAssets($.extend({}, string2json(id), {assetsTag: 2}));
            }
        } else if(tag == 'hospital'){
            location.href = '<%=basePath%>/charts/hospital/type-index/page?departmentId=' + id + '&hospitalId=' + hspId;
        } else if(tag == 'type'){
            location.href = '<%=basePath%>/charts/hospital/model-index/page?typeId=' + id + '&hospitalId=' + hspId;
        } else if(tag == 'device' && deviceRedirect) {
            window.open('<%=basePath%>/charts/overview/assets/page?deviceId=' + id);
        } else if (tag === 'year') {
            publicAjax('<%=basePath%>/charts/hospital/department-index/department', 'post', {
                hospitalId: hspId,
                departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                riskId: riskId ? JSON.stringify(riskId) : '',
                typeId: typeId ? JSON.stringify(typeId) : '',
                brandId: brandId ? JSON.stringify(brandId) : '',
                year: id,
                monthId: monthId ? JSON.stringify(monthId) : '',
                enableYearStart: enableYearStart,
                enableYearEnd: enableYearEnd,
                priceStart: priceStart,
                priceEnd: priceEnd,
                ageLimitStart: ageLimitStart,
                ageLimitEnd: ageLimitEnd
            }, function (data) {
                if (data.ret && data.data && data.data.list) {
                    chartYear = (data.data.list || []).sortByKey('curPrice').calTotal();
                } else {
                    chartYear = [];
                }
                morehospitals({
                    id: id,
                    dataJson: chartYear,
                    modal: 'typeModal',
                    table: 'typeTable'
                });
            });
        }
    }

    // 通过设备型号查找设备(设备类型)
    function queryDeviceData(detailId) {
        if($(".detail-tr-"+detailId).hasClass("hide")){
            $(".detail-tr-"+detailId).removeClass("hide");
            $("#detail-"+detailId).removeClass("fa-plus");
            $("#detail-"+detailId).addClass("fa-minus");
            $.ajax({
                type: "POST",
                url: '<%=basePath%>/charts/hospital/department-index/device',
                data: {
                  hospitalId: hspId,
                    riskId: riskId ? JSON.stringify(riskId) : '',
                    departmentId: departmentName ? JSON.stringify(departmentName) : '',
                    typeId: typeId ? JSON.stringify(typeId) : '',
                    brandId: brandId ? JSON.stringify(brandId) : '',
                    year: year ? JSON.stringify(year) : '',
                    enableYearStart: enableYearStart,
                    enableYearEnd: enableYearEnd,
                    priceStart: priceStart,
                    priceEnd: priceEnd,
                    ageLimitStart: ageLimitStart,
                    ageLimitEnd: ageLimitEnd
                },
                dataType: "json",
                success: function (data) {
                    if(data.ret == 1){
                        data.data = data.data || {list:[]};
                        if(data.data.list.length){
                            var sb = new StringBuffer();
                            $("#detail-table-"+detailId).html('<tbody id="table_data"></tbody>');
                            sb.append("<thead><tr><th class='text-center'>#</th>");
                            //表头
                            sb.append("<th class='text-left'><fmt:message key="share.table.head.sbmc"/></th>");

                            //表格内容
                            sb.append("<th class='text-left'><fmt:message key="share.assets.sbxh"/></th>"
                                + "<th class='text-left'><fmt:message key="share.assets.ssks"/></th>"
                                + "<th class='text-left'><fmt:message key="share.assets.snbh"/></th>"
                                + "<th class='text-left'><fmt:message key="share.assets.zcbh"/></th>"
                                + "<th class='text-left'><fmt:message key="share.table.head.sbcj"/></th>"
                                + "<th class='text-right'><fmt:message key="share.assets.sbje(wy)"/></th>"
                                + "<th class='text-right'><fmt:message key="share.assets.zjje(wy)"/></th>"
                                + "<th class='text-right'><fmt:message key="share.assets.sbqyrq"/></th>"
                                + "<th class='text-right'><fmt:message key="share.assets.ysysj(n)"/></th>"
                                + "<th class='text-right'><fmt:message key="share.assets.nxzs"/></th>"
                                + "</tr></thead>");
                            $("#detail-table-"+detailId).prepend(sb.toString());
                            for (var i = 0; i < data.data.list.length; i++) {
                                $("#detail-table-"+detailId+" tbody").append("<tr>"
                                    + "<td class='text-center'>" + (i + 1) + "</td>"
                                    + "<td class='spanTitle' onclick=query(\"device\",\""+data.data.list[i].id+"\") title='" + (data.data.list[i].name || '') + "'>" + (data.data.list[i].name || '') + "</td>"
                                    + "<td class='text-left'>" + (data.data.list[i].modalName || '') + "</td>"
                                    + "<td class='text-left'>" + (data.data.list[i].department || '') + "</td>"
                                    + "<td class='text-left'>" + (data.data.list[i].sn || '') + "</td>"
                                    + "<td class='text-left'>" + (data.data.list[i].assetsNo || '') + "</td>"
                                    + "<td class='text-left'>" + (data.data.list[i].manufacturer || '') + "</td>"
                                    + "<td class='text-right'>" + parseFloat((data.data.list[i].price / CONST) || 0).toFixed(2) + "</td>"
                                    + "<td class='text-right'>" + parseFloat((data.data.list[i].depreciationPrice / CONST) || 0).toFixed(2) + "</td>"
                                    + "<td class='text-right'>" + (data.data.list[i].enableDate || '') + "</td>"
                                    + "<td class='text-right'>" + parseFloat(data.data.list[i].usedTime || 0).toFixed(2) + "</td>"
                                    + "<td class='text-right'>" + parseFloat(data.data.list[i].ageLimitMeasure || 0).toFixed(2) + "</td>"
                                    + "</tr>");
                            }

                        }else{
                            $("#detail-table-"+detailId).html('<p><fmt:message key="share.talbe.myxgjl"/></p>');
                        }
                    } else{
                        flavrShowByTime(data.msg, null, "danger", false);
                    }
                },
                failure: function () {
                    flavrShowByTime(data.msg, null, "danger", false);
                }
            })
        }else{
            $(".detail-tr-"+detailId).addClass("hide");
            $("#detail-"+detailId).addClass("fa-plus");
            $("#detail-"+detailId).removeClass("fa-minus");
        }
    }

    function queryDeviceTable(param) {
            $.ajax({
                type: "POST",
                url: '<%=basePath%>/charts/hospital/department-index/device',
                data: $.extend({}, {
                    hospitalId: hspId,
                    departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                    riskId: riskId ? JSON.stringify(riskId) : '',
                    typeId: typeId ? JSON.stringify(typeId) : '',
                    brandId: brandId ? JSON.stringify(brandId) : '',
                    year: year ? JSON.stringify(year) : '',
                    monthId: monthId ? JSON.stringify(monthId) : '',
                    enableYearStart: enableYearStart,
                    enableYearEnd: enableYearEnd,
                    priceStart: priceStart,
                    priceEnd: priceEnd,
                    ageLimitStart: ageLimitStart,
                    ageLimitEnd: ageLimitEnd
                }, param),
                dataType: "json",
                success: function (data) {
                    if(data.ret){
                        data.data = data.data || {list:[]};
                        if(data.data.list.length){
                            var sb = new StringBuffer();
                            sb.append("<tr><th class='text-center'>#</th>");
                            //表头
                            sb.append("<th class='text-left'><fmt:message key="share.table.head.sbmc"/></th>");
                            //表格内容
                            sb.append("<th class='text-left'><fmt:message key="share.assets.sbxh"/></th>"
                                + "<th class='text-left'><fmt:message key="share.title.sblx"/></th>"
                                + "<th class='text-left'><fmt:message key="share.assets.ssks"/></th>"
                                + "<th class='text-left'><fmt:message key="share.assets.snbh"/></th>"
                                + "<th class='text-left'><fmt:message key="share.assets.zcbh"/></th>"
                                + "<th class='text-left'><fmt:message key="share.table.head.sbcj"/></th>"
                                + "<th class='text-right'><fmt:message key="share.assets.sbje(wy)"/></th>"
                                + "<th class='text-right'><fmt:message key="share.assets.zjje(wy)"/></th>"
                                + "<th class='text-right'><fmt:message key="share.assets.sbqyrq"/></th>"
                                + "<th class='text-right'><fmt:message key="share.assets.ysysj(n)"/></th>"
                                + "<th class='text-right'><fmt:message key="share.assets.nxzs"/></th>"
                                + "</tr>");
                            var str = '';
                            for (var i = 0; i < data.data.list.length; i++) {
                                str += "<tr>"
                                    + "<td class='no-cal text-center'>" + (i + 1) + "</td>"
                                    + "<td class='no-cal spanTitle' onclick=query(\"device\",\""+data.data.list[i].id+"\") title='" + (data.data.list[i].name || '') + "'>" + (data.data.list[i].name || '') + "</td>"
                                    + "<td class='no-cal text-left'>" + (data.data.list[i].modalName || '') + "</td>"
                                    + "<td class='no-cal'>" + fixStr(data.data.list[i].firstTypeName) + "</td>"
                                    + "<td class='no-cal text-left'>" + (data.data.list[i].department || '') + "</td>"
                                    + "<td class='no-cal text-left'>" + (data.data.list[i].sn || '') + "</td>"
                                    + "<td class='no-cal text-left'>" + (data.data.list[i].assetsNo || '') + "</td>"
                                    + "<td class='no-cal text-left'>" + (data.data.list[i].manufacturer || '') + "</td>"
                                    + "<td class='total-1 text-right'>" + parseFloat((data.data.list[i].price / CONST) || 0).toFixed(2) + "</td>"
                                    + "<td class='total-2 text-right'>" + parseFloat((data.data.list[i].depreciationPrice / CONST) || 0).toFixed(2) + "</td>"
                                    + "<td class='no-cal text-right'>" + (data.data.list[i].enableDate || '') + "</td>"
                                    + "<td class='avg-1 text-right'>" + parseFloat(data.data.list[i].usedTime || 0).toFixed(2) + "</td>"
                                    + "<td class='avg-2 text-right'>" + parseFloat(data.data.list[i].ageLimitMeasure || 0).toFixed(2) + "</td>"
                                    + "</tr>";
                            }
                            addAssetModal('<fmt:message key="share.talbe.sbxq"/>', sb.toString(), str);
                        }
                    } else{
                        flavrShowByTime(data.msg, null, "danger", false);
                    }
                },
                failure: function () {
                    flavrShowByTime(data.msg, null, "danger", false);
                }
            })
    }

    $('.option_overyear').click(function(){
        if($(this).hasClass('active')){
            $('#moredetail').html('<fmt:message key="charts.title.yyksfb"/>').off().on('click', morehospitals);
            $('.option_overyear').html('<fmt:message key="charts.button.lnsj"/>').removeClass('active');
            showYearTop5();
            chart.clear();
            chart.setOption(optionAgelimit);
            $('.quadrantContainner').show();
            $('.quadrant').removeClass('active');
        } else{
            loading(function () {
                $('.quadrantContainner').hide();
                $('.option_overyear').html('<fmt:message key="charts.button.qbxs"/>').addClass('active');
                showYearTop5(true);
                $('#moredetail').html('<fmt:message key="charts.button.lnsj"/>').off().on('click', moreyear);
                xAxisB = [];
                idsB = [];
                seriesCurPrice = [];
                seriesCurCount = [];
                seriesCurAgeLimitMeasure = [];
                seriesCurDepreciationPrice = [];
                seriesDepreciationRatio = [];
                $("#ul_year").html('');
                $.ajax({
                    url: '<%=basePath%>/charts/hospital/department-index/year-trend',
                    data: {
                        hospitalId: hspId,
                        departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                        riskId: riskId ? JSON.stringify(riskId) : '',
                        typeId: typeId ? JSON.stringify(typeId) : '',
                        brandId: brandId ? JSON.stringify(brandId) : '',
                        year: year ? JSON.stringify(year) : '',
                        enableYearStart: enableYearStart,
                        enableYearEnd: enableYearEnd,
                        priceStart: priceStart,
                        priceEnd: priceEnd,
                        ageLimitStart: ageLimitStart,
                        ageLimitEnd: ageLimitEnd
                    },
                    type: 'post',
                    success: function (data) {
                        if (data.ret) {
                            data.data = data.data || {list: []};
                            yearJson = data.data.list;
                            for (var i = 0; i < data.data.list.length; i++) {
                                xAxisB.push(data.data.list[i].name || '');
                                idsB.push(data.data.list[i].id || '');
                                seriesCurPrice.push(parseFloat((data.data.list[i].curPrice / CONST) || 0).toFixed(2));
                                seriesCurCount.push(data.data.list[i].curCounts || 0);
                                seriesCurAgeLimitMeasure.push(parseFloat(data.data.list[i].curAgeLimitMeasure || 0).toFixed(2));
                                seriesCurDepreciationPrice.push(parseFloat((data.data.list[i].curDepreciationPrice / CONST) || 0).toFixed(2));
                                seriesDepreciationRatio.push(parseFloat(data.data.list[i].depreciationRatio || 0).toFixed(2));

                                $("#ul_year").append(
                                    '<li><a onclick="moreyear()"><span class="fl data_span_f spanTitle">' + data.data.list[i].name + '</span><em class="fr">'
                                    + parseFloat((data.data.list[i].curPrice / CONST) || 0).toFixed(2) + '</em></a></li>');
                            }
                            optionB.xAxis.data = xAxisB;
                            optionB.series[0].data = seriesCurPrice;
                            optionB.series[1].data = seriesCurCount;
                            chart.clear();
                            chart.setOption(optionB);
                            loading(true);
                        } else {
                            flavrShowByTime(data.msg, null, "danger", false);
                        }
                    },
                    failure: function (data) {
                        flavrShowByTime(data.msg, null, "danger", false);
                    }
                });
            });
        }
    });

    function moreyear() {
        loading(function () {
            var sb = new StringBuffer();
            $("#tblSort").html('<tbody id="table_data"></tbody>');
            sb.append("<thead><tr><th class='text-center'>#</th>");
            //表头
            sb.append("<th class='text-left'><fmt:message key="share.table.head.nf"/></th>");

            //表格内容
            sb.append("<th class='text-right'><fmt:message key="index.table.sbje(wy)"/></th>"
                + "<th class='text-right'><fmt:message key="index.table.ncsbje(wy)"/></th>"
                + "<th class='text-right'><fmt:message key="index.table.sbsl(t)"/></th>"
                + "<th class='text-right'><fmt:message key="index.table.xzsbsl(t)"/></th>"
                + "<th class='text-right'><fmt:message key="index.table.bfsl(t)"/></th>"
                + "<th class='text-right'><fmt:message key="index.table.zjje(wy)"/></th>"
                + "<th class='text-right'><fmt:message key="index.table.zjl(%)"/></th>"
                + "<th class='text-right'><fmt:message key="index.table.nxzs"/></th>"
                + "</tr></thead>");
            $("#tblSort").prepend(sb.toString());
            for (var i = 0; i < xAxisB.length; i++) {
                $("#table_data").append("<tr>"
                    + "<td class='no-cal text-center'>" + (i + 1) + "</td>"
                    + "<td class='no-cal text-left spanTitle' onclick=\"query('year','" + idsB[i] + "')\">" + xAxisB[i] + "</td>"
                    + "<td class='total-1 text-right'>" + parseFloat(seriesCurPrice[i]).toFixed(2) + "</td>"
                    + "<td class='total-1 text-right'>" + parseFloat(yearJson[i].curBeginPrice / CONST || 0).toFixed(2) + "</td>"
                    + "<td class='total-2 text-right'>" + seriesCurCount[i] + "</td>"
                    + "<td class='total-2 text-right" + (yearJson[i].curNewlyCounts ? ' spanTitle' : '') + "' onclick=\"query('newly','{year:" + yearJson[i].id + "}'," + yearJson[i].curNewlyCounts + ")\">" + (yearJson[i].curNewlyCounts || 0) + "</td>"
                    + "<td class='total-2 text-right" + (yearJson[i].curScrapCounts ? ' spanTitle' : '') + "' onclick=\"query('scrap','{year:" + yearJson[i].id + "}'," + yearJson[i].curScrapCounts + ")\">" + (yearJson[i].curScrapCounts || 0) + "</td>"
                    + "<td class='total-3 text-right'>" + parseFloat(seriesCurDepreciationPrice[i]).toFixed(2) + "</td>"
                    + "<td class='avg-5 text-right'>" + parseFloat(seriesDepreciationRatio[i]).toFixed(2) + "</td>"
                    + "<td class='average-1 text-right'>" + parseFloat(seriesCurAgeLimitMeasure[i]).toFixed(2) + "</td>"
                    + "</tr>");
            }
            calTableData("tblSort", true);
            $('#modal').iziModal('setTitle', '<fmt:message key="charts.button.lnsj"/>');
            $('#modal').iziModal('open', this);
            loading(true);
        });
    }

    //医院等级分布饼状图
    var optionHospitalLevel = {
        color: ['#2089ff', '#6c63ff', '#12a0df'],
        backgroundColor: '#373945',
        tooltip: {
            trigger: 'item',
            formatter: function(param){
                return param.name + ':' + param.value + '<fmt:message key="share.unit.tai"/>(' + param.percent + '%)<br/>' +
                    '<fmt:message key="index.overview.yyks.sbje"/>:' + departmentPrice[param.dataIndex] + '<fmt:message key="share.unit.wanyuan"/>';
            },
            position : ['-60%', '-10%']
        },
        series: [{
            name: "",
            type: 'pie',
            avoidLabelOverlap: false,
            label: {
                normal: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    show: false,
                    textStyle: {
                        fontSize: 0.4 * rem,
                        fontWeight: 'bold'
                    }
                }
            },
            labelLine: {
                normal: {
                    show: false
                }
            },
            data: []
        }]
    };
    //医院等级分布饼状图
    var optionTypeList = {
        color: ['#2089ff', '#6c63ff', '#12a0df'],
        backgroundColor: '#373945',
        tooltip: {
            trigger: 'item',
            formatter: function(param){
                return param.name + '(' + param.percent + '%)<br/>' +
                    '<fmt:message key="index.overview.yyks.sbje"/>:' + param.value + '<fmt:message key="share.unit.wanyuan"/><br/>' +
                    '<fmt:message key="index.overview.yyks.sbsl"/>:' + TypeListPrice[param.dataIndex] + '<fmt:message key="share.unit.tai"/><br/>';
            },
            position : ['-60%', '-10%']
        },
        series: [{
            name: "",
            type: 'pie',
            avoidLabelOverlap: false,
            label: {
                normal: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    show: false,
                    textStyle: {
                        fontSize: 0.4 * rem,
                        fontWeight: 'bold'
                    }
                }
            },
            labelLine: {
                normal: {
                    show: false
                }
            },
            data: []
        }]
    };

    // 柱状 + 折线
    var optionB = {
        title: {
            show: false,
            text: '医疗机构分布',
            textStyle: {
                fontSize: 0.26 * rem
            }
        },
        /* animation:false,['#d14a61', , "#ffd47a"] */
        color: ['#2089ff', '#6c63ff', '#12a0df', '#fb8a22', '#fef534'],
        backgroundColor: '#373945',
        tooltip: {
            trigger: 'axis',
            axisPointer: { // 坐标轴指示器，坐标轴触发有效
                type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
            },
            textStyle: {
                fontSize: 0.28 * rem
            },
            formatter: function (a) {
                if(a.componentType == "markLine"){
                    return a.name + ':' + a.value;
                } else{
                    var index = a[0].dataIndex;
                    return xAxisB[index] + '<br/>'
                        + '<fmt:message key="index.overview.yyks.sbje"/>：' + seriesCurPrice[index] + '<fmt:message key="share.unit.wanyuan"/><br/>'
                        + '<fmt:message key="index.overview.yyks.sbsl"/>：' + seriesCurCount[index] + '<fmt:message key="share.unit.tai"/>';
                }
            }
        },
        legend: {
            x: "right",
            textStyle: {
                color: '#AAA',
                fontSize: 0.28 * rem
            },
            data: ['<fmt:message key="index.overview.yyks.sbje"/>', '<fmt:message key="index.overview.yyks.sbsl"/>']
        },
        grid: {
            top: 1.2 * rem,
            left: 0.4 * rem,
            right: 0.4 * rem,
            bottom: 0.8 * rem,
            containLabel: true
        },
        xAxis: {
            type: 'category',
            data: [],
            axisLabel: {
                rotate: 30,
                fontSize: 0.28 * rem
            }
        },
        yAxis: [{
            name: '<fmt:message key="share.unit.wanyuan"/>',
            type: 'value',
            nameTextStyle: {
                color: '#AAA',
                fontSize: 0.28 * rem
            },
            splitLine: {
                lineStyle: {
                    type: 'dashed'
                }
            },
            axisLabel: {
                fontSize: 0.28 * rem
            }
        }, {
            name: '<fmt:message key="share.unit.tai"/>',
            type: 'value',
            nameTextStyle: {
                color: '#AAA',
                fontSize: 0.28 * rem
            },
            splitLine: {
                show: false
            },
            axisLabel: {
                fontSize: 0.28 * rem
            }
        }],
        series: [{
            name: '<fmt:message key="index.overview.yyks.sbje"/>',
            type: 'bar',
            barGap:'0%',
            barMaxWidth: barMaxWidth,
            data: []
        }, {
            name: '<fmt:message key="index.overview.yyks.sbsl"/>',
            type: 'bar',
            yAxisIndex: 1,
            barMaxWidth: barMaxWidth,
            data: []
        }]
    };

    //设备年限气泡图
    var optionAgelimit = {
        title: {
            show: false,
            text: '设备年限分布',
            textStyle: {
                fontSize: 0.26 * rem
            }
        },
        color: ['#31860f'],
        backgroundColor: '#373945',
        tooltip: {
            trigger: 'item',
            /*  axisPointer: { // 坐标轴指示器，坐标轴触N发有效
                  type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
              },*/
            textStyle: {
                fontSize: 0.28 * rem
            },
            formatter: function (a) {
                if(a.componentType == "markLine"){
                    return a.name + ':' + a.value;
                } else{
                    var index = a.dataIndex;
                    return fixStr(hospitalJson[index][lang==='en'?'enName':'name']) + '<br/>'
                        + '<fmt:message key="index.overview.yyks.sbje"/>：' + fix2(hospitalJson[index].curPrice/CONST) + '<fmt:message key="share.unit.wanyuan"/><br/>'
                        + '<fmt:message key="index.overview.yyks.sbsl"/>：' + fix0(hospitalJson[index].curCounts) + '<fmt:message key="share.unit.tai"/><br/>'
                        + '<fmt:message key="charts.index.sbjetb"/>：' + fix2(hospitalJson[index].devicePriceYoy) + '%<br/>'
                        + '<fmt:message key="charts.index.sbsltb"/>：' + fix2(hospitalJson[index].deviceCountsYoy) + '%<br/>'
                        + '<fmt:message key="index.table.nxzs"/>：' + fix2(hospitalJson[index].curAgeLimitMeasure);
                }
            }
        },
        dataZoom: [{
                type: 'inside',
                xAxisIndex: [0],
                start: 0,
                end: 100
            },
            {
                type: 'inside',
                yAxisIndex: [0],
                start: 0,
                end: 100
            }
        ],
        grid: {
            top: 1.2 * rem,
            left: rem * 0.4,
            right: 2.4 * rem,
            bottom: 0.8 * rem,
            containLabel: true
        },
        xAxis: {
            name: '<fmt:message key="index.overview.yyks.sbje"/>：<fmt:message key="share.unit.wanyuan"/>',
            type: 'value',
            nameTextStyle: {
                color: '#fff',
                fontSize: 0.28 * rem
            },
            axisLabel: {
                show: true,
                fontSize: parseInt(0.28 * rem),
                textStyle: {
                    color: '#fff'
                }
            },
            splitLine: {
                show: false,
                lineStyle: {
                    color: '#f00',
                    type: 'dashed'
                }
            },
            axisLine: {
                lineStyle: {
                    color: '#fff'
                }
            },
            axisTick: {
                lineStyle: {
                    color: '#fff'
                }
            }
        },
        yAxis: [{
            name: '<fmt:message key="charts.axis.sbsl-t"/>',
            type: 'value',
            nameTextStyle: {
                color: '#fff',
                fontSize: 0.28 * rem
            },
            axisLabel: {
                show: true,
                fontSize: 0.28 * rem,
                textStyle: {
                    color: '#fff'
                }
            },
            splitLine: {
                show: false,
                lineStyle: {
                    color: '#f00',
                    type: 'dashed'
                }
            },
            axisLine: {
                lineStyle: {
                    color: '#fff'
                }
            },
            axisTick: {
                lineStyle: {
                    color: '#fff'
                }
            }
        }],
        series: [{
            type: 'scatter',
            data: [],
            symbolSize: function (data) {
                var max = hospitalJson.max('curAgeLimitMeasure'),
                    min = hospitalJson.min('curAgeLimitMeasure'),
                    range = max - min;
                if (data[2] === 0) return 0;
                if (range == 0) return 35;
                return data[2] === 0 ? 0 : (30 * (data[2] - min) / range + 20);
            },
            markLine: {
                lineStyle: {
                    normal: {
                        color: '#f00',
                        type: 'dashed',
                        opacity: 0.4
                    }
                },
                data: [
                    {type: 'average', name: '<fmt:message key="charts.avg.sbjepjz(wy)"/>',valueIndex: 0,xAxis: null},
                    {type: 'average', name: '<fmt:message key="charts.avg.sbslpjz(t)"/>',valueIndex: 1,yAxis: null}
                ]
            }
        }]
    };
</script>
</body>
</fmt:bundle>
</html>
